package logCollect;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class MakeLog {
    public static void main(String[] args) {
        Random random = new Random();
        //定义appname
        ArrayList<String> appNameList = new ArrayList<String>();
        appNameList.add("爱奇艺");
        appNameList.add("优酷");
        appNameList.add("酷狗");
        appNameList.add("土豆");
        appNameList.add("腾讯");
        ArrayList<String> appTypeList = new ArrayList<String>();
        appTypeList.add("视频");
        appTypeList.add("音乐");
        ArrayList<String> appViewList = new ArrayList<String>();
        appViewList.add("雪豹");
        appViewList.add("战狼");
        appViewList.add("西游记");
        appViewList.add("僵尸");
        ArrayList<Boolean> appCooList = new ArrayList<Boolean>();
        appCooList.add(true);
        appCooList.add(false);
        ArrayList<String> provincenameList = new ArrayList<String>();
        provincenameList.add("湖南");
        provincenameList.add("湖北");
        ArrayList<List<String>> cityList = new ArrayList<List<String>>();
        ArrayList<String> citys = new ArrayList<String>();
        citys.add("长沙");
        citys.add("株洲");
        ArrayList<String> city1s = new ArrayList<String>();
        city1s.add("武汉");
        city1s.add("十堰");
        cityList.add(citys);
        cityList.add(city1s);


        for (int i = 0; i < 1000; i++) {
            //创建流量的类
            LiuLiang liuLiang = new LiuLiang();
            //创建trafficInfo类
            //设置ttrafficInfo的值
            Double up = random.nextDouble();
            Double down = random.nextDouble();
            //定义trafficInfo应该有几个元素的随机数
            int trafficInfoCount = random.nextInt(3);
            ArrayList<logCollect.trafficInfo> trafficInfos = new ArrayList<trafficInfo>();
            for (int m = 0; m < trafficInfoCount; m++) {
                trafficInfo trafficInfo = new trafficInfo(
                        appNameList.get(random.nextInt(appNameList.size())),
                        appTypeList.get(random.nextInt(appTypeList.size())),
                        appNameList.get(random.nextInt(appNameList.size())).hashCode() + "",
                        appTypeList.get(random.nextInt(appTypeList.size())),
                        up,
                        down,
                        up + down,
                        appViewList.get(random.nextInt(appViewList.size())),
                        "武侠",
                        "成龙",
                        "hongkong",
                        "1991",
                        "5",
                        "ch",
                        "baidu",
                        appCooList.get(random.nextInt(appCooList.size())),
                        "并欺凌",
                        30 * 1024.0,
                        15 * 1024.0
                );
                trafficInfos.add(trafficInfo);
            }
            //traffic
            //创建traffic类
            int provinceindex =random.nextInt(provincenameList.size());
            traffic traffic = new traffic(
                    30.0,
                    12.8,
                    0.0,
                    0.0,
                    0.0,
                    provincenameList.get(provinceindex),
                   cityList.get(provinceindex).get(0),
                   // cityList.get(provinceindex).get(random.nextInt(cityList.get(provinceindex).size())),
                    trafficInfos);
            //创建details类
            details details = new details(provincenameList.get(provinceindex),
                    cityList.get(provinceindex).get(random.nextInt(2)),
                    "20200819", 12.4, 22.4, "",
                    "imei:"+random.nextInt(10),
                    "mac:"+random.nextInt(10),
                    "idfa:"+random.nextInt(10),
                    "openudid:"+random.nextInt(10),
                    "androidid:"+random.nextInt(10),
                    "imeimd5:"+random.nextInt(10),
                    "macmd5:"+random.nextInt(10),
                    "idfamd5:"+random.nextInt(10),
                    "openudidmd5:"+random.nextInt(10),
                    "androididmd5:"+random.nextInt(10),
                    "imeisha1:"+random.nextInt(10),
                    "macsha1:"+random.nextInt(10),
                    "idfasha1:"+random.nextInt(10),
                    "openudidsha1:"+random.nextInt(10),
                    "androididsha1:"+random.nextInt(10)
            );
            liuLiang.requestCode = 200;
            liuLiang.details = details;
            liuLiang.traffic = traffic;
            System.out.println(liuLiang.toString());
        }
    }
}
